let mongoose=require('mongoose');
const USER='root';
const PWD='12345678';
const DB_NAME='pandashop';
const DB_URL='localhost';
module.exports=new Promise((resolve,reject)=>{
    mongoose.connect(`mongodb://${USER}:${PWD}@${DB_URL}/${DB_NAME}?authSource=admin`,{
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useCreateIndex:true
    })
    mongoose.connection.on('open',(err)=>{
        if(!err){
            resolve(`位于${DB_URL}下的${DB_NAME}数据库连接成功`)
        }else{
            reject(err)
        }
    })
})
